define([
        'app/utils/WebUtils',
        'app/utils/WeixinUtils',
        'text!app/tpl/createOrg.html',

        "app/directive/CreateOrganizationDirective"
        
        ], function (
        WebUtils,
        WeixinUtils,
        createOrgTpl,
        CreateOrganizationDirective
    ) {  

    var controller = function () {

        //0. Weixin Disabled
        WeixinUtils.disableAll();

        //1. Data Initialized
        if($.isNull($.getHashUrlParam("unionid"))){
            $.redirectTo($.wjtBaseBackend + "/mvc/authorize?state=login");
            return;
        }

        //2. Weixin Initialized
        WeixinUtils.disableAll();


        //3. tpl Initialized - Never change!!!
        var tpl = WebUtils.tplInitialized();

        //4. UI Initialized
        var createOrgUI = _.template(createOrgTpl)({
            
        });
       

        //4. Assemble
        tpl.append(createOrgUI);

        //5. Render - Never change!!!
        WebUtils.render(tpl);

        //6. Directive initialized
        CreateOrganizationDirective.directive_createOrgButton();
        CreateOrganizationDirective.directive_inputName();
        CreateOrganizationDirective.directive_TextareaDes();
        CreateOrganizationDirective.directive_avatar1();
          

        //7. routechange - Never change!!!
        controller.onRouteChange = WebUtils.routeChange;

    };

    return controller;


});
